package com.nuedu.corejava.ch2.homework;

import java.util.Scanner;

public class HomeWork2 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		System.out.println("请输入一个0~1000的整数");
		int x=sc.nextInt();
		int a,b,c,d,sum;
		a=x/1000;
		b=x/100%10;
		c=x/10%10;
		d=x%10;
		sum=a+b+c+d;
		System.out.println("sum="+sum);
	}

}
